Looping Level Sections
"Level Boundaries" not only set the beginning and ending/upper and lower extents that a
Player and his screen can progress in a level, but they can also be used to set the
beginning and end/top and bottom of a looping section of the level.
Any section of a level can be made to loop on the X and/or Y axis. When looping is
active, the beginning of the given level section will be repeated at the end, and the
end will be repeated at the beginning. Players and Objects will "wrap around" once
they cross either border- if they cross the end, their position will be adjusted so
that they are moved to the beginning, and if they cross the beginning, their position
will be adjusted so that they are moved to the end. The area will appear to repeat
forever until looping is disabled and new boundaries are set.
Although Level/Loop Boundaries can be set at any point in the level (pixel by pixel),
it's recommended that they be set at the beginning of the first tile, and the
beginning of the tile that comes directly after the last one (the boundary positions
should be divisible by 8).
Other important notes:
- Never place objects within "Activity Range" of any side of a looping area.
This subjects them to the wrap-around effect of the looping area, meaning that when level looping is activated, Objects
in this area will mistakenly have their positions adjusted as if they "wrapped around" the looping area.
- Dynamic level section looping (looping level sections that are set and unset during
gameplay) will not function properly in 2-player split-screen mode. There is no way
to apply proper looping control to Objects when both players have different Level
Boundary settings while looping is active. If both players have the same settings,
however (such as with a level that always loops from top to bottom), it will work
properly in 2-player mode.
- Built-in and Scripted Player/Object and Projectile/Object collision tests that are performed during the "Collision Phase"
automatically account for looping level sections, but if any scripted collision tests are performed at any other time, such
as during an Object's "Movement Phase", Objects on the other side of the
looping area (Ex: A player is near the end of the looping area, and he can see an Object "in front of him" where the level
repeats, although that Object's position, at the beginning of the looping area) can not be
"properly" tested for collision unless this is accounted for manually, through the use of a Script Command such as
_Player_SetCollisionArea_CurrObj.
Level looping is controlled by the following "Game Variables":
23 - LevelBound_X1[0]
24 - LevelBound_X1[1]
25 - LevelBound_Y1[0]
26 - LevelBound_Y1[1]
27 - LevelBound_X2[0]
28 - LevelBound_X2[1]
29 - LevelBound_Y2[0]
30 - LevelBound_Y2[1]
31 - Target_LevelBound_X1[0]
32 - Target_LevelBound_X1[1]
33 - Target_LevelBound_Y1[0]
34 - Target_LevelBound_Y1[1]
35 - Target_LevelBound_X2[0]
36 - Target_LevelBound_X2[1]
37 - Target_LevelBound_Y2[0]
38 - Target_LevelBound_Y2[1]
39 - XLoop_Active[0]
40 - XLoop_Active[1]
41 - YLoop_Active[0]
42 - YLoop_Active[1]
43 - BGOffsetX[0]
44 - BGOffsetX[1]
45 - BGOffsetY[0]
46 - BGOffsetY[1]
47 - XLoop_Size[0]
48 - XLoop_Size[1]
49 - YLoop_Size[0]
50 - YLoop_Size[1]
These values may be set manually, but it is recommended that they be set by use of
the _Player_SetTargetBounds" Script Command.